﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace OpenST.Tiles
{
    class RandomDirectionTile : BaseTile
    {
        public RandomDirectionTile(ContentManager content)
            : base(content)
        {
            Sprite = content.Load<Texture2D>("Tiles/RandomDirectionTile");
            GetsSaved = true;

            List<Bug.Direction> Directions = new List<Bug.Direction>();
            Directions.Add(Bug.Direction.Down);
            Directions.Add(Bug.Direction.Up);
            Directions.Add(Bug.Direction.Left);
            Directions.Add(Bug.Direction.Right);

            TileData.Add("Directions", Directions);
        }

        public override void Process(Bug bug)
        {
            List<Bug.Direction> Directions = (List<Bug.Direction>)TileData["Directions"];

            // Pick a random direction to go in!
            Random Rand = new Random();
            int DirectionInt = Rand.Next(Directions.Count);
            bug.CurrentDirection = Directions[DirectionInt];

            // Normal tile just plays the audio
            bug.PlaySound(NoteNumber);
            base.Process(bug);
        }

        public override void Update(GameTime gameTime)
        {
            
            //base.Update(gameTime);
        }
    }
}
